//
//  NewsTableViewCell.m
//  projectA_kuaiZuiManHua
//
//  Created by mk on 15-3-23.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "NewsTableViewCell.h"
#import "UIImageView+WebCache.h"
#import "UIColor+AddColor.h"
@implementation NewsTableViewCell
- (void)dealloc
{
    [_myImageView release];
    [_label release];
    [_backView release];
    [_news release];
    [super dealloc];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
    
        self.backView = [[UIView alloc]init];
        self.backView.backgroundColor = [UIColor ticColor];
        
        [self.contentView addSubview:self.backView];
        [_backView release];
        
        self.myImageView = [[UIImageView alloc]init];
        self.myImageView.backgroundColor = [UIColor redColor];
        [self.backView addSubview:self.myImageView];
        [_myImageView release];
        
        self.label = [[UILabel alloc]init];
        [self.backView addSubview:self.label];
        [self.label release];
   

        
    }
    return self;

}
-(void)layoutSubviews
{
    [super layoutSubviews];
     CGFloat width = self.contentView.bounds.size.width ;
     CGFloat height = self.contentView.bounds.size.height ;
    self.backView.frame = CGRectMake(5, 5, width - 10, height - 10);
    self.backView.layer.cornerRadius  = 10;
    
    
    self.label.frame = CGRectMake(5, 10,self.backView.frame.size.width, 20);
    self.myImageView.frame = CGRectMake(30, 30, self.backView.frame.size.width - 50, self.backView.frame.size.height - 35);
    
    self.label.text = self.news.name;
    
    NSURL *url  = [NSURL URLWithString:[self.news.cover stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding ] ];
    [ self.myImageView setImageWithURL:url];
 
 
}







@end
